package com.taimi.springbootzendaodemo.system.component;

import java.util.Locale;
import java.util.Set;

import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController;
import com.gargoylesoftware.htmlunit.WebClient;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.context.IContext;

@Configuration
public class Components {

    @Bean
    public WebClient webClient() {
        WebClient webClient = new WebClient();
        webClient.setAjaxController(new NicelyResynchronizingAjaxController());
        return webClient;
    }

    @Bean
    public IContext paramsContext() {
        return new IContext() {

            @Override
            public Locale getLocale() {
                return Locale.SIMPLIFIED_CHINESE;
            }

            @Override
            public boolean containsVariable(String name) {
                return false;
            }

            @Override
            public Set<String> getVariableNames() {
                return null;
            }

            @Override
            public Object getVariable(String name) {
                return null;
            }
        };
    }
}